package User;

import Operation.*;

import java.util.Scanner;

public class AdminUser extends User{
    public AdminUser(String name) {
        super(name);
        //存入管理者可以使用的功能 - 菜单与下标一一对应
        this.iOperations = new IOperation[]{
                new Exit(),
                new Add(),
                new Find(),
                new Del(),
                new Show()
        };
    }
    //管理者的菜单
    @Override
    public int menu() {
        System.out.println("**************************");
        System.out.println("欢迎 " + this.name +"来到图书小练习！" );
        System.out.println("1. 增加图书");
        System.out.println("2. 查找图书");
        System.out.println("3. 删除图书");
        System.out.println("4. 展示图书");
        System.out.println("0. 退出系统");
        System.out.println("**************************");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择操作：");
        while (true){
            int choice = scanner.nextInt();
            if(choice<=4 && choice>=0)
                return choice;
            System.out.println("输入错误！");
        }
    }
}
